//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101
//#include "stdafx.h"
#include "YoYCapFloorTermPriceSurface.h"
using namespace Cephei::QL::Experimental::Inflation;
#include <gen/QL/Times/Period.h>
#include <gen/QL/Indexes/YoYInflationIndex.h>
#include <gen/QL/Termstructures/YieldTermStructure.h>
#include <gen/QL/Times/DayCounter.h>
#include <gen/QL/Times/Calendar.h>
#include <gen/QL/Math/Matrix.h>
#include <gen/QL/Termstructures/YoYInflationTermStructure.h>
#include <gen/QL/Termstructures/Inflation/Seasonality.h>
#include <gen/QL/Termstructures/InflationTermStructure.h>
using namespace Cephei::QL::Times;
using namespace Cephei::QL::Indexes;
using namespace Cephei::QL::Termstructures;
using namespace Cephei::QL::Math;
using namespace Cephei::QL::Termstructures::Inflation;
#define HANDLE
#define ABSTRACT
#undef STRUCT
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>& childNative, Object^ owner) : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
#ifdef HANDLE
	_phYoYCapFloorTermPriceSurface = NULL;
#endif
	_ppYoYCapFloorTermPriceSurface = &childNative;
    _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
}
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (QuantLib::YoYCapFloorTermPriceSurface& childNative, Object^ owner) : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
#ifdef HANDLE
	_phYoYCapFloorTermPriceSurface = NULL;
#endif
	_ppYoYCapFloorTermPriceSurface = new boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface> (&childNative);
    _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
    _YoYCapFloorTermPriceSurfaceOwner = owner;
    _InflationTermStructureOwner = owner;
}

Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (CYoYCapFloorTermPriceSurface^ copy) : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
#ifdef HANDLE
	_phYoYCapFloorTermPriceSurface = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppYoYCapFloorTermPriceSurface = new boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface> (copy->GetShared());
        _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
    }
}
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (System::Type^ t) : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
#ifdef HANDLE
	_phYoYCapFloorTermPriceSurface = NULL;
#endif
	if (!t->IsSubclassOf(CYoYCapFloorTermPriceSurface::typeid))
		throw gcnew Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface>& childNative, Object^ owner)  : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
	_phYoYCapFloorTermPriceSurface = &childNative;
	_ppYoYCapFloorTermPriceSurface = &static_cast<boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>>(childNative.currentLink());
    _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
    _YoYCapFloorTermPriceSurfaceOwner = owner;
}
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface> childNative)  : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
	_phYoYCapFloorTermPriceSurface = &childNative;
	_ppYoYCapFloorTermPriceSurface = &static_cast<boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>>(childNative.currentLink());
    _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
}
#endif
#ifdef STRUCT
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CYoYCapFloorTermPriceSurface (QuantLib::YoYCapFloorTermPriceSurface childNative)  : CInflationTermStructure(CYoYCapFloorTermPriceSurface::typeid)
{
#ifdef HANDLE
	_phYoYCapFloorTermPriceSurface = NULL;
#endif
	_ppYoYCapFloorTermPriceSurface = new boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface> (new QuantLib::YoYCapFloorTermPriceSurface (childNative));
    _ppInflationTermStructure = new boost::shared_ptr<QuantLib::InflationTermStructure> (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
}
#endif

Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::~CYoYCapFloorTermPriceSurface ()
{
    if (_ppYoYCapFloorTermPriceSurface != NULL)
    {
	    delete _ppYoYCapFloorTermPriceSurface;
        _ppYoYCapFloorTermPriceSurface = NULL;
    }
}
Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::!CYoYCapFloorTermPriceSurface ()
{
    if (_ppYoYCapFloorTermPriceSurface != NULL)
    {
	    delete _ppYoYCapFloorTermPriceSurface;
    }
}
QuantLib::YoYCapFloorTermPriceSurface& Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::GetReference ()
{
    if (_ppYoYCapFloorTermPriceSurface == NULL) throw gcnew NativeNullException ();
	return **_ppYoYCapFloorTermPriceSurface;
}
boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>& Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::GetShared ()
{
    if (_ppYoYCapFloorTermPriceSurface == NULL) throw gcnew NativeNullException ();
	return *_ppYoYCapFloorTermPriceSurface;
}
QuantLib::YoYCapFloorTermPriceSurface* Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::GetPointer ()
{
    if (_ppYoYCapFloorTermPriceSurface == NULL) throw gcnew NativeNullException ();
	return &**_ppYoYCapFloorTermPriceSurface;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface>& Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::GetHandle ()
{
	if (_phYoYCapFloorTermPriceSurface == NULL)
	{
		_phYoYCapFloorTermPriceSurface = new Handle<QuantLib::YoYCapFloorTermPriceSurface> (*_ppYoYCapFloorTermPriceSurface);
	}
	return *_phYoYCapFloorTermPriceSurface;
}
#endif
bool Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::HasNative () 
{
	return (_ppYoYCapFloorTermPriceSurface != NULL);
}

Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::AtmYoYRate (Cephei::QL::Times::IPeriod^ d, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ obsLag, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate)
{
    CPeriod^ _Cd;
    CPeriod^ _CobsLag;
    try
    {
        _Cd = safe_cast<CPeriod^> (d);
        _Cd->Lock();
        QuantLib::Period& _d = static_cast<QuantLib::Period&> (_Cd->GetReference ()); 
        if (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (obsLag))
        {
            _CobsLag = safe_cast<CPeriod^> (obsLag->Value);
            _CobsLag->Lock();
        }
        QuantLib::Period& _obsLag = 
            (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (obsLag) ? static_cast<QuantLib::Period&> (_CobsLag->GetReference ()) : QuantLib::Period(-1,Days)); //6
        bool _extrapolate = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (extrapolate) ? (bool)ValueHelper::Convert (extrapolate->Value) : true); //9a
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->atmYoYRate ( _d,  _obsLag,  _extrapolate );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cd != nullptr) _Cd->Unlock();
        if (_CobsLag != nullptr) _CobsLag->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::AtmYoYRate (DateTime d, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ obsLag, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate)
{
    CPeriod^ _CobsLag;
    try
    {
        QuantLib::Date _d = (QuantLib::Date)ValueHelper::Convert (d);
        if (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (obsLag))
        {
            _CobsLag = safe_cast<CPeriod^> (obsLag->Value);
            _CobsLag->Lock();
        }
        QuantLib::Period& _obsLag = 
            (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (obsLag) ? static_cast<QuantLib::Period&> (_CobsLag->GetReference ()) : QuantLib::Period(-1,Days)); //6
        bool _extrapolate = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (extrapolate) ? (bool)ValueHelper::Convert (extrapolate->Value) : true); //9a
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->atmYoYRate ( _d,  _obsLag,  _extrapolate );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_CobsLag != nullptr) _CobsLag->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::AtmYoYSwapRate (Cephei::QL::Times::IPeriod^ d, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate)
{
    CPeriod^ _Cd;
    try
    {
        _Cd = safe_cast<CPeriod^> (d);
        _Cd->Lock();
        QuantLib::Period& _d = static_cast<QuantLib::Period&> (_Cd->GetReference ()); 
        bool _extrapolate = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (extrapolate) ? (bool)ValueHelper::Convert (extrapolate->Value) : true); //9a
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->atmYoYSwapRate ( _d,  _extrapolate );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cd != nullptr) _Cd->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::AtmYoYSwapRate (DateTime d, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate)
{
    try
    {
        QuantLib::Date _d = (QuantLib::Date)ValueHelper::Convert (d);
        bool _extrapolate = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (extrapolate) ? (bool)ValueHelper::Convert (extrapolate->Value) : true); //9a
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->atmYoYSwapRate ( _d,  _extrapolate );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
QL::Times::BusinessDayConventionEnum Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::BusinessDayConvention::get ()
{
    try
    {
    	QuantLib::BusinessDayConvention _rv = (QuantLib::BusinessDayConvention)(*_ppYoYCapFloorTermPriceSurface)->businessDayConvention ( );   
        QL::Times::BusinessDayConventionEnum _nrv = (QL::Times::BusinessDayConventionEnum)_rv;
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CapPrice (Cephei::QL::Times::IPeriod^ d, Double k)
{
    CPeriod^ _Cd;
    try
    {
        _Cd = safe_cast<CPeriod^> (d);
        _Cd->Lock();
        QuantLib::Period& _d = static_cast<QuantLib::Period&> (_Cd->GetReference ()); 
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->capPrice ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cd != nullptr) _Cd->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CapPrice (DateTime d, Double k)
{
    try
    {
        QuantLib::Date _d = (QuantLib::Date)ValueHelper::Convert (d);
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->capPrice ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::IVector<Double>^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::CapStrikes::get ()
{
    try
    {
    	std::vector<QuantLib::Rate> _rv = (std::vector<QuantLib::Rate>)(*_ppYoYCapFloorTermPriceSurface)->capStrikes ( );   
        Cephei::IVector<Double>^ _nrv = gcnew CoVector<Double> (gcnew CDoubleVector (_rv));
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
UInt32 Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::FixingDays::get ()
{
    try
    {
    	QuantLib::Natural _rv = (QuantLib::Natural)(*_ppYoYCapFloorTermPriceSurface)->fixingDays ( );   
        UInt32 _nrv = (UInt32)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::FloorPrice (Cephei::QL::Times::IPeriod^ d, Double k)
{
    CPeriod^ _Cd;
    try
    {
        _Cd = safe_cast<CPeriod^> (d);
        _Cd->Lock();
        QuantLib::Period& _d = static_cast<QuantLib::Period&> (_Cd->GetReference ()); 
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->floorPrice ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cd != nullptr) _Cd->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::FloorPrice (DateTime d, Double k)
{
    try
    {
        QuantLib::Date _d = (QuantLib::Date)ValueHelper::Convert (d);
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->floorPrice ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::IVector<Double>^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::FloorStrikes::get ()
{
    try
    {
    	std::vector<QuantLib::Rate> _rv = (std::vector<QuantLib::Rate>)(*_ppYoYCapFloorTermPriceSurface)->floorStrikes ( );   
        Cephei::IVector<Double>^ _nrv = gcnew CoVector<Double> (gcnew CDoubleVector (_rv));
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::IVector<Cephei::QL::Times::IPeriod^>^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::Maturities::get ()
{
    try
    {
    	std::vector<QuantLib::Period> _rv = (std::vector<QuantLib::Period>)(*_ppYoYCapFloorTermPriceSurface)->maturities ( );   
        CoVector<Cephei::QL::Times::IPeriod^>^ _nrv = gcnew CoVector<Cephei::QL::Times::IPeriod^>(gcnew CPeriodVector (_rv));
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
DateTime Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::MaxMaturity::get ()
{
    try
    {
    	QuantLib::Date _rv = (QuantLib::Date)(*_ppYoYCapFloorTermPriceSurface)->maxMaturity ( );   
        DateTime _nrv = (DateTime)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::MaxStrike::get ()
{
    try
    {
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->maxStrike ( );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
DateTime Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::MinMaturity::get ()
{
    try
    {
    	QuantLib::Date _rv = (QuantLib::Date)(*_ppYoYCapFloorTermPriceSurface)->minMaturity ( );   
        DateTime _nrv = (DateTime)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::MinStrike::get ()
{
    try
    {
    	QuantLib::Rate _rv = (QuantLib::Rate)(*_ppYoYCapFloorTermPriceSurface)->minStrike ( );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::Price (Cephei::QL::Times::IPeriod^ d, Double k)
{
    CPeriod^ _Cd;
    try
    {
        _Cd = safe_cast<CPeriod^> (d);
        _Cd->Lock();
        QuantLib::Period& _d = static_cast<QuantLib::Period&> (_Cd->GetReference ()); 
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->price ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cd != nullptr) _Cd->Unlock();
    }
}
Double Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::Price (DateTime d, Double k)
{
    try
    {
        QuantLib::Date _d = (QuantLib::Date)ValueHelper::Convert (d);
        QuantLib::Rate _k = (QuantLib::Rate)ValueHelper::Convert (k);
    	QuantLib::Real _rv = (QuantLib::Real)(*_ppYoYCapFloorTermPriceSurface)->price ( _d,  _k );   
        Double _nrv = (Double)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::IVector<Double>^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::Strikes::get ()
{
    try
    {
    	std::vector<QuantLib::Rate> _rv = (std::vector<QuantLib::Rate>)(*_ppYoYCapFloorTermPriceSurface)->strikes ( );   
        Cephei::IVector<Double>^ _nrv = gcnew CoVector<Double> (gcnew CDoubleVector (_rv));
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Indexes::IYoYInflationIndex^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::YoyIndex::get ()
{
    try
    {
    	boost::shared_ptr<QuantLib::YoYInflationIndex> _rv = (boost::shared_ptr<QuantLib::YoYInflationIndex>)(*_ppYoYCapFloorTermPriceSurface)->yoyIndex ( );   
        Cephei::QL::Indexes::CYoYInflationIndex^ _nrv = gcnew Cephei::QL::Indexes::CYoYInflationIndex (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
DateTime Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::YoyOptionDateFromTenor (Cephei::QL::Times::IPeriod^ p)
{
    CPeriod^ _Cp;
    try
    {
        _Cp = safe_cast<CPeriod^> (p);
        _Cp->Lock();
        QuantLib::Period& _p = static_cast<QuantLib::Period&> (_Cp->GetReference ()); 
    	QuantLib::Date _rv = (QuantLib::Date)(*_ppYoYCapFloorTermPriceSurface)->yoyOptionDateFromTenor ( _p );   
        DateTime _nrv = (DateTime)ValueHelper::Convert (_rv);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cp != nullptr) _Cp->Unlock();
    }
}
Cephei::QL::Termstructures::IYoYInflationTermStructure^ Cephei::QL::Experimental::Inflation::CYoYCapFloorTermPriceSurface::YoYTS::get ()
{
    try
    {
    	boost::shared_ptr<QuantLib::YoYInflationTermStructure> _rv = (boost::shared_ptr<QuantLib::YoYInflationTermStructure>)(*_ppYoYCapFloorTermPriceSurface)->YoYTS ( );   
        Cephei::QL::Termstructures::CYoYInflationTermStructure^ _nrv = gcnew Cephei::QL::Termstructures::CYoYInflationTermStructure (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw gcnew NativeExcpetion (gcnew System::String(_error.what()));
        else
		    throw gcnew NativeExcpetion (gcnew System::String("Unknown std::exception"));
	}
    finally
    {
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

